home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
enigma
/
earcd
/
comm
/
comm2
/
ctsrc701.lha
/
liblog2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-01
|
2KB
|
76 lines
/*
* liblog2.c
*
* Citadel log code for the library
*/
/*
* history
*
* 89Feb05 HAW File created.
*/
#include "ctdl.h"
/*
* Contents
*
* findPerson() Loads a log record.
* PersonExists() See if given name is valid for mail.
*/
extern CONFIG cfg;
extern logBuffer logTmp, logBuf;
extern LogTable *logTab;
extern char onConsole, remoteSysop;
/*
* findPerson()
*
* This function loads a log record for named person.
* RETURNS: ERROR if not found, else log record #
*/
int findPerson(char *name, logBuffer *lBuf)
{
int h, i, foundIt, logNo;
if (strLen(name) == 0) return ERROR;
if (strCmpU(name, "Citadel") != SAMESTRING)
{
h = hash(name);
for (foundIt = i = 0; i < cfg.MAXLOGTAB && !foundIt; i++)
{
if (logTab[i].ltnmhash == h)
{
getLog(lBuf, logNo = logTab[i].ltlogSlot);
if (lBuf->lbflags.L_INUSE &&
strCmpU(name, lBuf->lbname) == SAMESTRING)
{
foundIt = TRUE;
}
}
}
}
else foundIt = FALSE;
if (!foundIt) return ERROR;
else return logNo;
}
/*
* PersonExists()
*
* This function will check to see if the given name is valid for mail.
*
* This includes special processing for "Sysop" and "Citadel".
*/
int PersonExists(char *name)
{
int result;
if ((strCmpU("Citadel", name) == SAMESTRING && HalfSysop()) ||
strCmpU("sysop", name) == SAMESTRING)
return (int)cfg.MAXLOGTAB; /* signals special string */
result = findPerson(name, &logTmp);
if (result != ERROR) strCpy(name, logTmp.lbname);
return result;
}